<template>
  <div id="init">
    <div class="buttom">
      <button class="login" @click="routerLogin">登录</button>
      <button class="register" @click="routerRegister">注册</button>
    </div>
  </div>
</template>
<script>
import WebIM from "../../utils/WebIM";
export default {
  created() {
    // 判断是否存在登录的token
    if (this.$cookies.isKey("wxUserToken")) {
      // 退出登录
      WebIM.conn.close();
      // 清除tonken
      this.$cookies.remove("wxUserToken");
    }
  },
  methods: {
    // 跳转至登录页面
    routerLogin() {
      this.$router.push({
        path: "/login",
      });
    },
    // 跳转至注册页面
    routerRegister() {
      this.$router.push({
        path: "/register",
      });
    },
  },
};
</script>
<style  lang="scss" scoped>
#init {
  position: relative;
  width: 100vw;
  height: 100vh;
  background-image: url(../../assets/image/images/loginImg/login.png);
  background-position: center bottom;
  background-size: cover;
  background-repeat: no-repeat;

  .buttom {
    position: absolute;
    bottom: 50px;
    width: 100%;
    display: flex;
    flex-direction: row;
    justify-content: space-evenly;

    button {
      padding: 13px;
      width: 40%;
      outline: 0px;
      border: 0px;
      border-radius: 3px;
    }

    .register {
      background-color: var(--theme-green);
      color: #fff;
    }
  }
}
</style>